package org.texteasy.views;

import org.texteasy.R;

import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;

public class ButtonBarView extends LinearLayout {

	public static final int NEW_MESSAGE_ID = R.id.btn_new_message;
	public static final int OPTIONS_ID = R.id.btn_options;
	public static final int SEARCH_ID = R.id.btn_search;
	public static final int FORWARD_ID = R.id.btn_fwd_message;
	
	public ButtonBarView(Context arg0, AttributeSet arg1) {
		super(arg0, arg1);
	}
	
	@Override
	protected void onFinishInflate() {
		super.onFinishInflate();
		
		((Activity)getContext()).getLayoutInflater().inflate(R.layout.btn_bar, this);
	}
	
	public void setNewMessageClickListener(View.OnClickListener listener){
		findViewById(NEW_MESSAGE_ID).setOnClickListener(listener);
	}

	public void setOptionsClickListener(View.OnClickListener listener){
		findViewById(OPTIONS_ID).setOnClickListener(listener);
	}
	
	public void setSearchClickListener(View.OnClickListener listener){
		findViewById(SEARCH_ID).setOnClickListener(listener);
	}
	
	public void setSearchButtonVisibility(int visibility){
		findViewById(SEARCH_ID).setVisibility(visibility);
	}
	
	public void setNewMessageEnabled(boolean enabled){
		findViewById(NEW_MESSAGE_ID).setEnabled(enabled);
	}
	
	public void setForwardMessageClickLister(View.OnClickListener listener){
		findViewById(FORWARD_ID).setOnClickListener(listener);
	}
}
